﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="article.aspx.cs" Inherits="newBlog.model.article" %>

<%@ Import Namespace="newBlog.CenterInc.Ctrltor" %>
<%@ Import Namespace="newBlog.CenterInc.model" %>
<%@ Register Src="~/model/allLink.ascx" TagPrefix="uc1" TagName="allLink" %>
<% 
        if (Session["user_id"]==null) {
        Response.Redirect("/index.aspx");
    }
    int article_id = Request.QueryString["id"] == null ? 1 : Convert.ToInt32(Request.QueryString["id"]);
    Article_inc article_Inc = new Article_inc();
    Comment_inc comment_Inc = new Comment_inc();
    List<Article_itemDao> list = article_Inc.article_content(article_id);
    List<Comment_ArticleDao> commentlist = comment_Inc.Comment_Article_items(article_id);
    fans_follow_inc fans_Follow_Inc = new fans_follow_inc();
    
%>

<!DOCTYPE html>

<html >
<head >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><%=list[0].Title %>-<%=Application["title"] %></title>
    <meta name="description" content="<%=Application["content"] %>">
    <meta name="keywords" content="<%=Application["key"] %>">
    <uc1:allLink runat="server" ID="allLink" />
    <link rel="stylesheet" href="/css/article.css?<%=DateTime.Now.ToString("yyyyMMddHHmmssffff") %>">
    <script src="/js/model/article.js?<%=DateTime.Now.ToString("yyyyMMddHHmmssffff") %>"></script>
</head>
<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md9 ">
                <div class="layui-panel">
                    <div class="layui-card">
                        <div class="layui-card-header"><%=list[0].Title %></div>
                        <!--标题-->
                        <div class="layui-card-header">
                            <span class="layui-breadcrumb tipsLeft" style="">
                                <a href=""><%=list[0].Catalog %></a>
                                <a><cite>正文</cite></a>
                            </span>
                            <div class="tipsRight">
                                <span class="layui-badge layui-bg-blue">
                                    <i class="layui-icon layui-icon-reply-fill"></i>
                                    <span><%=list[0].CommentCount %></span>
                                </span>
                                <span class="layui-badge">
                                    <i class="layui-icon layui-icon-dollar"></i>
                                    <span><%=list[0].Price %></span>
                                </span>
                            </div>
                        </div>
                        <!--面包屑-->
                        <div class="layui-card-body layui-text	">
                            <%=list[0].ArticleContent %>
                        </div>
                        <!--内容-->


                        <%if (article_Inc.GetCharge(article_id))
                            {
                        %>
                        <div class="layui-collapse">
                            <div class="layui-colla-item">
                                <% if (Session["user_id"] != null)
                                    {
                                        string temp = article_Inc.isPay(article_id, Session["user_id"].ToString());
                                %>

                                <%  if (temp != null)
                                    {
                                %>
                                <h2 class="layui-colla-title">您已购买成功请点击查看付费内容
                                </h2>
                                <div class="layui-colla-content"><%=temp %></div>
                                <%
                                    }
                                    else
                                    { %>
                                <h2 class="layui-colla-title">本文有收费内容，请支付<span class="layui-badge-rim"><%=list[0].Price %></span>积分后购买
                                    <button type="button" style="position: relative; top: 10px;" class="layui-btn layui-btn-xs layui-btn-primary tipsRight"  onclick="Pay_article(<%=article_id %>)">购买</button>
                                </h2>
                                <div class="layui-colla-content">点击支付才会显示内容</div>
                                <% 
                                        }
                                    }
                                    else
                                    {  %>
                                <h2 class="layui-colla-title">本文有收费内容，请登录后购买

                                </h2>
                                <div class="layui-colla-content">请登录本站</div>
                                <% 
                                    } %>
                            </div>
                        </div>

                        <% }
                        %>

                        <!--收费-->
                    </div>
                </div>
                <div class="RowSpace">
                    <div class="layui-panel">
                        <fieldset class="layui-elem-field ">
                            <% if (Session["user_id"] != null)
                                {
                            %>
                            <legend>
                                <img src="<%="/updata/portrait/"+Session["user_id"]+".png" %>" class="layui-circle border" width="40px" height="40px"><%=Session["user_name"] %></legend>
                            <div class="layui-field-box">
                                <textarea placeholder="请输入内容" id="CommentContent" class="layui-textarea"></textarea>
                            </div>
                            <div class="layui-row layui-col-space10" style="padding: 0 15px 10px 15px">
                                <div class="layui-col-md2 layui-col-xs6">
                                    <input type="text" id="EmailVer" maxlength="4" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-col-md2 layui-col-xs6">
                                    <button class="layui-btn layui-btn-primary layui-btn-fluid layui-border-blue" type="button" onclick="Seed_ver(this)">发送验证码</button>
                                </div>
                                <div class="layui-col-md2 ">
                                    <button class="layui-btn layui-btn-primary layui-btn-fluid layui-border-blue" type="button" onclick="Seed_content(this,<%=article_id %>)">发布评论</button>
                                </div>
                            </div>
                            <%
                                }
                                else
                                { %>
                            <legend>
                                <a href="javascript:window.parent.open_LoginResistPopup('登录账号','/model/login.aspx','425px','300px',false)">您未登录本站</a>
                            </legend>
                            <div class="layui-field-box">
                                <textarea placeholder="请输入内容" class="layui-textarea" disabled></textarea>
                            </div>
                            <%} %>
                        </fieldset>
                        <% if (commentlist.Count == 0)
                            {%>
                        <div style="text-align:center;font-size:20px" class="RowDownSpace">暂无评论</div>
                        <%}
                        else
                        {
                            int count = commentlist.Count;
                            int i = 0;
                            for (; i < count; i++)
                            {
                        %>
                        <fieldset class="layui-elem-field">
                            <legend>
                                <img src="<%=commentlist[i].CommentImg1 %>" class="layui-circle border" width="40px" height="40px"><%=commentlist[i].Username %> 说：</legend>
                            <div class="layui-field-box">
                                <%=commentlist[i].Content %>
                            </div>
                        </fieldset>
                        <%}
                            } %>
                        <!--评论条目-->
                    </div>
                </div>
            </div>
            <div class="layui-col-md3">
                <div class="layui-panel">
                    <div class="layui-row">
                        <div class="layui-col-md4 layui-col-xs4">
                            <img src="<%=list[0].AutorImg %>" class="layui-circle border elemXcenter" width="70px" height="70px" style="top:10px">
                        </div>
                        <!--作者头像-->
                        <div class="layui-col-md4 layui-col-xs4">
                            <div style="position: relative; margin-top: 40px">
                                <h2><%=list[0].AutorName %></h2>
                                等级：<span class="layui-badge layui-bg-gray"><%=list[0].Level > 1000 ? "王者" : list[0].Level > 800 ? "钻石" : list[0].Level > 500 ? "黄金" : list[0].Level > 300 ? "白银" : list[0].Level > 100 ? "青铜" : "普通" %></span>
                            </div>
                        </div>
                        <!--用户名等级-->
                    </div>
                    <hr>
                    <div class="layui-row layui-col-space10 text-style">
                        <div class="layui-col-md3 layui-col-xs3">文章</div>
                        <div class="layui-col-md3 layui-col-xs3">关注</div>
                        <div class="layui-col-md3 layui-col-xs3">粉丝</div>
                        <div class="layui-col-md3 layui-col-xs3">权限</div>
                        <div class="layui-col-md3 layui-col-xs3"><%=list[0].AutorArticleCount %></div>
                        <div class="layui-col-md3 layui-col-xs3"><%=list[0].FollowCount %></div>
                        <div class="layui-col-md3 layui-col-xs3"><%=list[0].FansCount %></div>
                        <div class="layui-col-md3 layui-col-xs3"><%=list[0].Grade %></div>
                    </div>
                    <!--作者信息-->
                    <div class="layui-row text-style layui-col-space10">
                        <div class="layui-col-md6 ">
                            <% 
                                
                                if(fans_Follow_Inc.SelectisFollow(Session["user_id"].ToString(),list[0].AutorID)){


%>
                            <button type="button" class="layui-btn  layui-btn-primary layui-border-blue layui-btn-fluid" onclick="cancelFollow(<%=list[0].AutorID %>)">取消关注</button>
                            <%
            }
            else
            {
                                    %>
                            <button type="button" class="layui-btn  layui-btn-primary layui-border-blue layui-btn-fluid" onclick="Follow(<%=list[0].AutorID %>)">关注</button>
                            <%

            }
                                %>
                            
                        </div>
                        <!--按钮1-->
                        <div class="layui-col-md6 ">
                            <button type="button" class="layui-btn  layui-btn-primary layui-border-blue layui-btn-fluid">私信</button>
                        </div>
                        <!--按钮2-->
                    </div>
                    <!--作者关注私信按钮-->
                </div>
                <!--作者框-->
                <div class="layui-panel RowSpace">
                    <div class="layui-card">
                        <div class="layui-card-header">本文封面</div>
                        <div class="layui-card-body">
                            <div class="layui-row">

                                <img src="<%=list[0].Articleimg %>" width="100%" height="200px">
                            </div>
                        </div>
                    </div>
                </div>
                <!--作者文章推荐-->
                <div class="layui-panel RowSpace">
                    <div class="layui-card">
                        <div class="layui-card-header">
                            本文简介
                        </div>
                        <div class="layui-card-body">
                            <div class="layui-row">
                                <%=list[0].Describe.Length==0?"暂无简介":list[0].Describe %>
                            </div>
                        </div>
                    </div>
                </div>
                <!--站内文章推荐-->
                <div class="layui-panel RowSpace">
                    <div class="layui-card">
                        <div class="layui-card-header">
                            最新公告
                        </div>
                        <div class="layui-card-body">
                            <p>公告1：<%=Application["notice1"] %></p>
                            <p>公告2：<%=Application["notice2"] %></p>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</body>
</html>
